#!/bin/sh

# Attempt to restore some video card state
if [ x$SAVE_VBE_STATE = xtrue ]; then
  vbetool vbestate restore <$VBESTATE
  if [ $VBEMODE != "3" ]; then
    vbetool vbemode set $VBEMODE;
  else
    vbetool vgamode set 3;
  fi
fi

# Restore video PCI state
if [ x$SAVE_VIDEO_PCI_STATE = xtrue ]; then
  for x in /sys/bus/pci/devices/*; do
    if [ -f /var/run/vga-pci-`basename $x` ]; then
        cat /var/run/vga-pci-`basename $x` >$x/config;
    fi
  done
fi

